import Vue from "vue";
import Vuex from "vuex";
import { Search } from "./music_data/Search";
import { Re_musicDataList } from "./music_data/Re_musicDataList";
import { musicDataList } from "./music_data/musicDataList";
import { detailsList } from "./music_data/detailsList";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    isLogin :false,
    datas: null,
    index: '',
    musicTime:{
      currentTime: 0,
      duration:0,
    },
    lyric: '',
  },
  mutations: {
    isLoginState(state) {
      state.isLogin = true;
    },
    noLoginState(state) {
      state.isLogin = false;
    },
    // ---------------
    toSongList(state,data){
      state.datas = data
    },
    songsIdx(state,idx){
      state.index = idx
    },
    getLyric(state,songLyric){
      state.lyric = songLyric
    }
  },
  actions: {},
  modules: {
    Search,
    Re_musicDataList,
    musicDataList,
    detailsList
  },
});
